package com.atguigu.spzx.product.controller;

import com.atguigu.spyx.model.common.Result;
import com.atguigu.spyx.model.vo.h5.CategoryVo;
import com.atguigu.spzx.product.service.CategoryService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author LT
 * @create 2023-11-17-18:35
 */
@RestController
@RequestMapping("/api/product/category")
//@CrossOrigin(originPatterns = "*" , allowCredentials = "true")
public class CategoryController {
    @Resource
    CategoryService categoryService;

    @GetMapping("/findCategoryTree")
    public Result findCategoryTres(){
        List<CategoryVo> parents = categoryService.findCategoryTree();
        return Result.ok().data(parents);
    }
}
